﻿using System;
using System.Collections.Generic;
using System.Xml;

/* Generated  */
namespace EDMXParserV1
{
        [Serializable]
    public class Association
    {
        public Association()
        {
            AssociationEnds = new List<AssociationEnd>();
        }

        public String Name { get; set; }

        public List<AssociationEnd> AssociationEnds { get; set; }
        public ReferentialConstraint ReferentialConstraint { get; set; }

        public static Association New(System.Xml.XmlNode Node)
        {
            Association Association = new Association();

            foreach (XmlAttribute Attribute in Node.Attributes)
            {
                switch (Attribute.Name)
                {
                    case "Name":
                        Association.Name = Attribute.Value;
                        break;
                    default:
                        Globals.AttributeSwitchCoder(Attribute);
                        break;
                }

            }

            foreach (XmlNode ChildNode in Node.ChildNodes)
            {
                switch (ChildNode.Name)
                {
                    case "End":
                        AssociationEnd AssociationEnd = AssociationEnd.New( ChildNode);
                        Association.AssociationEnds.Add(AssociationEnd);
                        break;
                    case "ReferentialConstraint":
                        Association.ReferentialConstraint = ReferentialConstraint.New(ChildNode);
                        break;
                    default:
                        Globals.NodeSwitchCoder(ChildNode);
                        break;
                }
            }

            return Association;
        }
    }
}
